//
// Created on 2024/11/14.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#include "ui_motion_animation_animateto_icurve_test.h"
#include "common/common.h"
#include <arkui/native_animate.h>
#include <arkui/native_interface.h>
#include <string>
#include <sstream>

static ArkUI_AnimateOption* animateOption = nullptr;
static ArkUI_NativeAnimateAPI_1 *animateApi = nullptr;
static ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr;
static ArkUI_NodeHandle createAnimate = nullptr;
static ArkUI_NodeHandle animateScale = nullptr;
static ArkUI_NodeHandle logText = nullptr;

static int NUMBER_1000 = 1000;
static int NUMBER_2000 = 2000;
static int32_t NUMBER_SCALE_BUTTON_EVENT = 9001;
static int32_t NUMBER_STEP_BUTTON_EVENT = 9002;
static int32_t NUMBER_LINEAR_BUTTON_EVENT = 9003;
static int32_t NUMBER_CUBIC_BUTTON_EVENT = 9004;
static int32_t NUMBER_SPRINGCURVE_BUTTON_EVENT = 9005;
static int32_t NUMBER_SPRINGMOTION_FIVE_BUTTON_EVENT = 9006;
static int32_t NUMBER_SPRINGMOTION_SIX_BUTTON_EVENT = 9007;
static int32_t NUMBER_RESPONSIVESPRINGMOTION_SEVEN_BUTTON_EVENT = 9008;
static int32_t NUMBER_RESPONSIVESPRINGMOTION_EIGHT_BUTTON_EVENT = 9009;
static int32_t NUMBER_INTERPOLATINGSPRING_NINE_BUTTON_EVENT = 9010;
static int32_t NUMBER_INTERPOLATINGSPRING_TEN_BUTTON_EVENT = 9011;
static int32_t NUMBER_INTERPOLATINGSPRING_ELEVEN_BUTTON_EVENT = 9012;
static int32_t NUMBER_INTERPOLATINGSPRING_TWELVE_BUTTON_EVENT = 9013;
static int32_t NUMBER_CUSTOMCURVE_THIRTEEN_BUTTON_EVENT = 9014;
static int32_t NUMBER_CUSTOMCURVE_FOURTEEN_BUTTON_EVENT = 9015;

struct UserData{
    int32_t data;
};

namespace ArkUICApiDemo {

static auto CreateComWithIDAndName(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string componentId,
    std::string comName, ArkUI_NodeType type = ARKUI_NODE_BUTTON)
{
    // 创建组件并添加到容器内
    if (type == ARKUI_NODE_BUTTON) {
        auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON);
        ArkUI_AttributeItem text_item = {nullptr, 0, comName.c_str()};
        nodeAPI->setAttribute(button, NODE_BUTTON_LABEL, &text_item);
        ArkUI_AttributeItem idStr;
        idStr.string = componentId.c_str();
        nodeAPI->setAttribute(button, NODE_ID, &idStr);
        return button;
    }
    if (type == ARKUI_NODE_WATER_FLOW) {
        auto createAnimateWaterFlow = nodeAPI->createNode(ARKUI_NODE_WATER_FLOW);
        ArkUI_NumberValue width_value[] = {{.f32 = SIZE_50}};
        ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)};
        ArkUI_NumberValue height_value[] = {{.f32 = SIZE_10}};
        ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)};
        nodeAPI->setAttribute(createAnimateWaterFlow, NODE_WIDTH, &width_item);
        nodeAPI->setAttribute(createAnimateWaterFlow, NODE_HEIGHT, &height_item);
        ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}};
        ArkUI_AttributeItem background_color_item = {background_color_value,
            sizeof(background_color_value) / sizeof(ArkUI_NumberValue)};
        nodeAPI->setAttribute(createAnimateWaterFlow, NODE_BACKGROUND_COLOR, &background_color_item);
        ArkUI_AttributeItem idStr;
        idStr.string = componentId.c_str();
        nodeAPI->setAttribute(createAnimateWaterFlow, NODE_ID, &idStr);
        return createAnimateWaterFlow;
    }
}

static void OnEventReceive(ArkUI_NodeEvent *event)
{
    if (event == nullptr) {
        OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "AnimateOnEventReceive",
            "OnEventReceive: event is null");
        return;
    }
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event);
    OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "OnEventReceive", "get eventId  %{public}d", eventId);
    
    if (eventId == NUMBER_CUSTOMCURVE_FOURTEEN_BUTTON_EVENT) {
        auto customInterpolate = [](float fraction,void* userData) -> float {
            float a = 0.0f; // 起点
            float b = 0.5f; // 控制点
            float c = 1.0f; // 终点
            return (1 - fraction) * (1 - fraction) * a + 2 * (1 - fraction) * fraction * b + fraction * fraction * c;
        };
        void* userData = nullptr; // 可以传递任何用户数据给插值回调
        ArkUI_CurveHandle customCurve = OH_ArkUI_Curve_CreateCustomCurve(userData, customInterpolate);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, customCurve);
        ArkUI_CurveHandle callbackLog = OH_ArkUI_AnimateOption_GetICurve(animateOption);
        OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkUI_CurveHandle", "CreateNativeNode option GetICurve = %{public}p", callbackLog);
        std::string log = "CreateNativeNode option GetICurve = " + std::to_string(reinterpret_cast<uintptr_t>(callbackLog));
        ArkUI_AttributeItem text_item = {};
        text_item.string = log.c_str();
        nodeAPI->setAttribute(logText, NODE_TEXT_CONTENT, &text_item);
    }
    if (eventId == NUMBER_CUSTOMCURVE_THIRTEEN_BUTTON_EVENT) {
        auto customInterpolate = [](float fraction,void* userData) -> float {
            // 返回 sqrt(fraction)，确保返回值也在 [0, 1] 范围内
            return std::sqrt(fraction);
        };
        void* userData = nullptr; // 可以传递任何用户数据给插值回调
        ArkUI_CurveHandle customCurve = OH_ArkUI_Curve_CreateCustomCurve(userData, customInterpolate);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, customCurve);
    }
    if (eventId == NUMBER_INTERPOLATINGSPRING_TWELVE_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateInterpolatingSpring(0, 100, 500, 100);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_INTERPOLATINGSPRING_ELEVEN_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateInterpolatingSpring(100, -10, -228, -30);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_INTERPOLATINGSPRING_TEN_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateInterpolatingSpring(-10, 100, 500, 100);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_INTERPOLATINGSPRING_NINE_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateInterpolatingSpring(100, 1, 1, 1);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_RESPONSIVESPRINGMOTION_EIGHT_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateResponsiveSpringMotion(-0.55, -0.825, -10);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_RESPONSIVESPRINGMOTION_SEVEN_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateResponsiveSpringMotion(0.5, 0.6, 5);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_SPRINGMOTION_SIX_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateSpringMotion(-0.55, -0.825, -10);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_SPRINGMOTION_FIVE_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateSpringMotion(0.5, 0.6, 5);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_SPRINGCURVE_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateSpringCurve(100, 1, 228, 30);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_CUBIC_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateCubicBezierCurve(0.1, -10.0, 0.1, -10.0);
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_LINEAR_BUTTON_EVENT) {
    }
    if (eventId == NUMBER_STEP_BUTTON_EVENT) {
        ArkUI_CurveHandle curveHandle = OH_ArkUI_Curve_CreateStepsCurve(10, false); //停顿10次
        OH_ArkUI_AnimateOption_SetICurve(animateOption, curveHandle);
    }
    if (eventId == NUMBER_SCALE_BUTTON_EVENT) {
        UserData* onFinishUser = new UserData;
        onFinishUser->data = 101; // 101 is onFinishUserData
        //设置完成的回调
        ArkUI_AnimateCompleteCallback* completeCallback = new ArkUI_AnimateCompleteCallback;
        completeCallback->userData = onFinishUser;
        completeCallback->type = ARKUI_FINISH_CALLBACK_REMOVED;
        completeCallback->callback = [](void* userData) {
            OH_LOG_Print(LOG_APP,LOG_ERROR, LOG_PRINT_DOMAIN, "Manager","CreateNativeNode onFinishCallback %{public}d",
                reinterpret_cast<UserData*>(userData)->data);
        };

        //用户自定义参数
        UserData* eventUser = new UserData;
        eventUser->data = 201; // 201 is userData
        ArkUI_ContextCallback* update = new ArkUI_ContextCallback;
        update->userData = eventUser;
        update->callback = [](void* user) {
            ArkUI_NumberValue custom_widthValue[] = { 200 }; // 200 is custom width
            ArkUI_AttributeItem custom_widthItem = {custom_widthValue, 1};
            ArkUI_NumberValue custom_heightValue[] = { 400 }; // 400 is custom height
            ArkUI_AttributeItem custom_heightItem = { custom_heightValue, 1};
            nodeAPI->setAttribute(createAnimate, NODE_WIDTH, &custom_widthItem);
            nodeAPI->setAttribute(createAnimate, NODE_HEIGHT, &custom_heightItem);
        };
        ArkUI_ContextHandle contextHandle = OH_ArkUI_GetContextByNode(createAnimate);
        animateApi->animateTo(contextHandle, animateOption, update, completeCallback);
    }
}

static void CreateAnimateOption()
{
    animateOption = OH_ArkUI_AnimateOption_Create();
    // 设置持续时间
    OH_ArkUI_AnimateOption_SetDuration(animateOption, NUMBER_2000);
    // 设置延迟时间
    OH_ArkUI_AnimateOption_SetDelay(animateOption, NUMBER_1000);
    // 设置播放次数
    OH_ArkUI_AnimateOption_SetIterations(animateOption, 1);
}

static void MotionButtonHandle(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string componentId, ArkUI_NodeHandle& rootNode)
{
    nodeAPI->addChild(rootNode, createAnimate);
    if (strcmp(componentId.c_str(), "OnClickButton0010") == 0) {
        auto linearButton = CreateComWithIDAndName(nodeAPI, componentId + "_linear", "linear");
        nodeAPI->registerNodeEvent(linearButton, NODE_ON_CLICK, NUMBER_LINEAR_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, linearButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0020") == 0) {
        auto stepButton = CreateComWithIDAndName(nodeAPI, componentId + "_step", "step");
        nodeAPI->registerNodeEvent(stepButton, NODE_ON_CLICK, NUMBER_STEP_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, stepButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0030") == 0) {
        auto cubicButton = CreateComWithIDAndName(nodeAPI, componentId + "_cubic", "cubic");
        nodeAPI->registerNodeEvent(cubicButton, NODE_ON_CLICK, NUMBER_CUBIC_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, cubicButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0040") == 0) {
        auto springCurveButton = CreateComWithIDAndName(nodeAPI, componentId + "_springCurve", "springCurve");
        nodeAPI->registerNodeEvent(springCurveButton, NODE_ON_CLICK, NUMBER_SPRINGCURVE_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, springCurveButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0050") == 0) {
        auto springMotionButton = CreateComWithIDAndName(nodeAPI, componentId + "_springMotion", "springMotion");
        nodeAPI->registerNodeEvent(springMotionButton, NODE_ON_CLICK, NUMBER_SPRINGMOTION_FIVE_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, springMotionButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0060") == 0) {
        auto springMotionButton = CreateComWithIDAndName(nodeAPI, componentId + "_springMotion", "springMotion");
        nodeAPI->registerNodeEvent(springMotionButton, NODE_ON_CLICK, NUMBER_SPRINGMOTION_SIX_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, springMotionButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0070") == 0) {
        auto responsiveSpringMotionButton = CreateComWithIDAndName(nodeAPI, componentId + "_responsiveSpringMotion", "responsiveSpringMotion");
        nodeAPI->registerNodeEvent(responsiveSpringMotionButton, NODE_ON_CLICK, NUMBER_RESPONSIVESPRINGMOTION_SEVEN_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, responsiveSpringMotionButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0080") == 0) {
        auto responsiveSpringMotionButton = CreateComWithIDAndName(nodeAPI, componentId + "_responsiveSpringMotion", "responsiveSpringMotion");
        nodeAPI->registerNodeEvent(responsiveSpringMotionButton, NODE_ON_CLICK, NUMBER_RESPONSIVESPRINGMOTION_EIGHT_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, responsiveSpringMotionButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0090") == 0) {
        auto interpolatingSpringButton = CreateComWithIDAndName(nodeAPI, componentId + "_interpolatingSpring", "interpolatingSpring");
        nodeAPI->registerNodeEvent(interpolatingSpringButton, NODE_ON_CLICK, NUMBER_INTERPOLATINGSPRING_NINE_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, interpolatingSpringButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0100") == 0) {
        auto interpolatingSpringButton = CreateComWithIDAndName(nodeAPI, componentId + "_interpolatingSpring", "interpolatingSpring");
        nodeAPI->registerNodeEvent(interpolatingSpringButton, NODE_ON_CLICK, NUMBER_INTERPOLATINGSPRING_TEN_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, interpolatingSpringButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0110") == 0) {
        auto interpolatingSpringButton = CreateComWithIDAndName(nodeAPI, componentId + "_interpolatingSpring", "interpolatingSpring");
        nodeAPI->registerNodeEvent(interpolatingSpringButton, NODE_ON_CLICK, NUMBER_INTERPOLATINGSPRING_ELEVEN_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, interpolatingSpringButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0120") == 0) {
        auto interpolatingSpringButton = CreateComWithIDAndName(nodeAPI, componentId + "_interpolatingSpring", "interpolatingSpring");
        nodeAPI->registerNodeEvent(interpolatingSpringButton, NODE_ON_CLICK, NUMBER_INTERPOLATINGSPRING_TWELVE_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, interpolatingSpringButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0130") == 0) {
        auto customCurveButton = CreateComWithIDAndName(nodeAPI, componentId + "_customCurve", "customCurve");
        nodeAPI->registerNodeEvent(customCurveButton, NODE_ON_CLICK, NUMBER_CUSTOMCURVE_THIRTEEN_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, customCurveButton);
    }
    if (strcmp(componentId.c_str(), "OnClickButton0140") == 0) {
        auto customCurveButton = CreateComWithIDAndName(nodeAPI, componentId + "_customCurve", "customCurve");
        nodeAPI->registerNodeEvent(customCurveButton, NODE_ON_CLICK, NUMBER_CUSTOMCURVE_FOURTEEN_BUTTON_EVENT, nullptr);
        nodeAPI->addChild(rootNode, customCurveButton);
        logText = nodeAPI->createNode(ARKUI_NODE_TEXT);
        ArkUI_AttributeItem text_item = {};
        text_item.string = "callback print log";
        nodeAPI->setAttribute(logText, NODE_TEXT_CONTENT, &text_item);
        nodeAPI->addChild(rootNode, logText);
    }
    // scale
    auto scaleButton = CreateComWithIDAndName(nodeAPI, componentId + "_scale", "scale");
    nodeAPI->registerNodeEvent(scaleButton, NODE_ON_CLICK, NUMBER_SCALE_BUTTON_EVENT, nullptr);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_ANIMATE, ArkUI_NativeAnimateAPI_1, animateApi);
    CreateAnimateOption();
    
    nodeAPI->registerNodeEventReceiver(&OnEventReceive);
    nodeAPI->addChild(rootNode, scaleButton);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0010(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0010", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0010", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0020(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0020", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0020", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0030(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0030", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0030", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0040(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0040", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0040", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0050(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0050", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0050", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0060(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0060", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0060", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0070(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0070", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0070", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0080(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0080", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0080", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0090(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0090", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0090", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0100(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0100", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0100", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0110(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0110", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0110", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0120(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0120", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0120", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0130(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0130", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0130", rootNode);
}

void UIMotionAnimationAnimatetoIcurve::CreateNativeNodeMAAIcurve0140(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode)
{
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    // 创建动画
    createAnimate = CreateComWithIDAndName(nodeAPI, "createAnimate0140", "创建动画组件", ARKUI_NODE_WATER_FLOW);
    MotionButtonHandle(nodeAPI, "OnClickButton0140", rootNode);
}

} // namespace ArkUICApiDemo